const redis = require('redis')
const config = require('../config/db').redis
const redisClient = redis.createClient(config.url, config.options)
const { promisify } = require('util')
const getAsync = promisify(redisClient.get).bind(redisClient)
const setAsync = promisify(redisClient.set).bind(redisClient)
const delAsync = promisify(redisClient.del).bind(redisClient)

module.exports.client = redisClient
module.exports.get = getAsync
module.exports.set = setAsync
module.exports.del = delAsync
